<html>
  <head>
    <meta charset="utf-8">  
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
<?php
$c = $_GET['t'];
$dz = file_get_contents("https://restapi.amap.com/v3/ip?key=5f5d6a5571e85f4128ba04723d5ffda2&ip=".real_ip());
$dz = json_decode($dz,true);



switch ($c) {
    //专辑列表页面
   case "li":
    $id = $_GET['id'];
    $num = $_GET['num'];
$result = file_get_contents("https://www.ximalaya.com/revision/album/v1/getTracksList?albumId=".$id."&pageNum=".$num);//列表
$json = json_decode($result,true);
$zhuanji = file_get_contents("https://www.ximalaya.com/revision/album/v1/simple?albumId=".$id);//专辑信息
$json1 = json_decode($zhuanji,true);
$zhuanji1 = file_get_contents("https://www.ximalaya.com/revision/comment/albumStatistics/".$id);//评分
$json2 = json_decode($zhuanji1,true);
$bc = $json1['data']['albumPageMainInfo']['playCount'] / 10000;
if($num == ""){
    $num = 1;
}


     echo '
          <title>'.$json1['data']['albumPageMainInfo']['albumTitle'].' - 趣音乐</title>
     </head>
     
     <div class="layui-row layui-col-space10">
  <div class="layui-col-md2">
    <img style="margin-left: 25%; width:150px;" src="'.$json1['data']['albumPageMainInfo']['cover'].'">
  </div>
  <div class="layui-col-md8">
<span class="layui-badge">评分:'.$json2['data']['albumScore'].'</span>
<span class="layui-badge-rim"><i class="layui-icon layui-icon-headset" style="font-size:12px; color: #E91E63;"></i>'.round($bc,2).'万</span>
<p><h3><span class="layui-badge layui-bg-blue">T</span>'.$json1['data']['albumPageMainInfo']['albumTitle'].'</h3></p>

<br>
  </div>
</div>
      

     <body>
     <div style="font-size: 30px;">列表<span style="font-size: 16px;margin-left: 22px;color: #a9a6a6;">一共'.$json['data']['trackTotalCount'].'首</span></div>
     <div style="padding: 10px;">
     ';
foreach ($json['data']['tracks'] as $key => $value)
{
    echo '<a href="?t=play&play='.$value['trackId'].'">'.$value['title'].'</a><hr>';
}

echo '</div><div class="layui-btn-group" style="margin-left:20px;"><button type="button" class="layui-btn layui-btn-primary layui-btn-sm">当前在第'.$num.'页</button></div>';

$fy = ceil($json['data']['trackTotalCount'] / 30);

for ($i=1; $i <= $fy; $i++){
    echo '
    <a href="?t=li&id='.$id.'&num='.$i.'"><button type="button" class="layui-btn layui-btn-primary layui-btn-sm">'.$i.'</button></a>
    ';
}
echo '<button type="button" class="layui-btn layui-btn-primary layui-btn-sm">共'.$fy.'页</button></div>';



     break;
     //播放页面
        case "play":
    $id = $_GET['play'];
    $result = file_get_contents("https://www.ximalaya.com/revision/play/v1/audio?id=".$id."&ptype=1");
$json = json_decode($result,true);
    
     echo '
     <title>播放 - 趣音乐</title>
     	<link href="https://aigeba.cn/function/css/show.css" type="text/css" rel="stylesheet" />
	<script src="https://aigeba.cn/function/js/jquery.min.js" type="text/javascript"></script>
     </head>
     <body>
     <div style="font-size: 30px;">播放</div>
     ';

//-------播放器
echo '
<div class="clear"></div>
<div style="padding-top:10px;">
	<div id="lanye_music_container" class="jp-audio" role="application" aria-label="media player">
		<div id="lanye_music" class="jp-jplayer" title="音乐试听" musicurl="'.$json['data']['src'].'">
		</div>
		<div class="jp-type-single">
			<div class="jp-gui jp-interface">
				<div class="jp-title" aria-label="title">
					&nbsp;
				</div>
				<div class="jp-controls">
					<button class="jp-play" role="button" tabindex="0">play</button> 
				</div>
				<div class="jp-volume-controls">
					<button class="jp-mute" role="button" tabindex="0">mute</button> 
				</div>
				<div class="play_gif">
				</div>
				<div class="jp-time-holder">
					<span class="jp-current-time" role="timer" aria-label="time">&nbsp;</span>/<span class="jp-duration" role="timer" aria-label="duration">&nbsp;</span> 
				</div>
				<div class="jp-progress">
					<div class="jp-seek-bar">
						<div class="jp-play-bar">
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div><div class="clear"></div>


<script>var swfpath = "function/lanye_music";</script>
<script type="text/javascript" src="https://aigeba.cn/function/lanye_music/lanye_music.js"></script>
';

     break;
     //首页
   default:
     $time = date('H');
     if ($time == 19 or $time ==20 or $time==21) {
        $yan = "HI~天晚了";
     }else if($time == 5 or $time ==6 or $time==7) {
        $yan = "HI~天亮了";
     }else if($time == 10 or $time ==11 or $time==12){
        $yan = "HI~中午了";
     }else if($time == 13 or $time ==14 or $time==15 or $time==16){
        $yan = "HI~下午了";
     }else if($time == 23 or $time ==00 or $time==1 or $time ==2 or $time ==3){
        $yan = "HI~夜已深";
     }else {
        $yan = "HI~你好呀！";
     }
     
     
     
     echo '
     <title>趣音乐 - 让音乐简单一点</title>
     </head>
     <body>
     <div style="font-size: 30px;">首页</div>
     
     <div style="padding: 10px;border: 1px solid #f3eded;border-radius: 10px;margin: 10px;">
     <p style="font-size: 22px;">'.$yan.'<span style="color:#a0a0a0;font-size:14px;">给你推荐了这些</span></p>
     ';
     if ($yan == "HI~夜已深") {
    echo '';
     }elseif($yan == "HI~天亮了"){
    echo '
<div class="layui-row layui-col-space10">
  <div class="layui-col-md6">
	<a href="?t=li&id=49807422">
<div>
<div style="float: left;width:60px;"><img width="56px" height="56px" src="https://p.pstatp.com/origin/pgc-image/78da8ff8caf54d4fa1fc5c13eb6d4ee7"></div>
<div><h3>清晨钢琴曲 | 孤单的早晨 轻音乐陪你度过</h3><p style="color:#a0a0a0;">清晨，森林是静谧的。</p></div>
</div>
	</a>
  </div>
  <div class="layui-col-md6">
	<a href="?t=li&id=42064569">
<div>
<div style="float: left;width:60px;"><img width="56px" height="56px" src="https://p.pstatp.com/origin/pgc-image/e0138d8d9bb64ef5937f2f6f1c52ceec"></div>
<div><h3>早晨轻音乐</h3><p style="color:#a0a0a0;">早晨醒来，一切都是那么美好。温暖的阳光化作窗帘挂在窗前，是那么的温馨。</p></div>
</div>
	</a>
  </div>
</div>
    ';
     }
     
     
     echo '</div>';
     echo '<div style="width: 100%;background: #a4d8f0;padding: 12px 0;"><span>更多随机音乐</span></div>';
     $result = file_get_contents("https://www.ximalaya.com/m-revision/page/index/queryCategoryFeed?moduleKey=yinyue");
$json = json_decode($result,true);
//echo $json['districts']['0']['districts']['0']['name'];

echo '<div style="padding: 15px;"><ul>';

foreach ($json['data']['materials'] as $key => $value)
     {
    //$key = $key+1;
    echo '<li>
    <a href="?t=li&id='.$value['data']['id'].'">
<div style="height: 78px;">
<div style="float: left;width:60px;"><img width="56px" height="56px" style="border-radius: 4px;" src="//imagev2.xmcdn.com/'.$value['data']['albumInfo']['cover'].'"></div>
<div><h3 style="white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">'.$value['data']['albumInfo']['title'].'</h3><p style="color:#a0a0a0;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">'.$value['data']['albumInfo']['shortIntro'].'</p></div>
</div>
<span><i class="layui-icon layui-icon-headset" style="font-size:16px; color: #1E9FFF;"></i>'.round($value['data']['statCountInfo']['playCount'] / 10000,2).'万<span>
<span style="float:right;"><i class="layui-icon layui-icon-chart" style="font-size:16px; color: #1E9FFF;"></i>'.$value['data']['statCountInfo']['trackCount'].'<span>
	</a>
    </li><hr>';
     }
     
echo '</ul></div>';

}




?>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
</body>
</html>



<?php
//函数库
function real_ip(){
  $ip = $_SERVER['REMOTE_ADDR'];
  if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s',
  $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
    foreach ($matches[0] AS $xip) {
      if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) {
        $ip = $xip;
        break;
      }
    }
  } elseif (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/',
  $_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
  } elseif (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/',
  $_SERVER['HTTP_CF_CONNECTING_IP'])) {
    $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
  } elseif (isset($_SERVER['HTTP_X_REAL_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/',
  $_SERVER['HTTP_X_REAL_IP'])) {
$ip = $_SERVER['HTTP_X_REAL_IP'];
  }
  return $ip;
}

?>